import { http } from "./http.js";

const $Api = {
  //名家详情
  api_getArtistInfo: "res/artist/info",//名家详情页 //已接
  api_getArtistAlbumList: "res/artist/albumlist",//代表作 //已接
  //搜素
  api_getAlbumList: "search/album/list",//按剧名搜索 //已接
  api_getArtistList: "search/artist/list",//按名家搜索 //已接
  // 精选数据
  api_get: "page/get",//轮播广告位&每日推荐
  api_localhot: "recommand/local/album",//当地红剧
  api_recommand: "recommand/album",//猜你喜欢
  // 首页数据
  api_getTagAlbumList: "tag/album/list",//栏目分类导航,推荐 //已接
  api_localSect: "recommand/local/sect",//栏目分类导航其他栏目 //已接
  api_getAlbumList: "search/album/list",//页面展示专辑数据 //已接
  api_addUserStore: "user/store/add/res",//添加收藏 //已接
  api_getAlbumResList: "album/res/list",//播放操作 //已接
  api_getPlayUrl: "play/get/playurl",//pb非空,视频播放地址信息接口 //已接
  api_addUserPlayLog: "user/play/add/res",//添加播放记录接口
  
  //我的
  api_getUserPlayHisResList: "user/play/get/reslist",//观看历史
  api_getUserStoreResList: "user/store/get/reslist",//我的收藏
  api_delUserPlayHis: "user/play/del/res",//删除历史记录
  api_delUserStore: "user/store/del/res",//删除我的收藏
  api_phone: "wx/minipro/phone", // 获取手机用户
  
  // 打印日志
  api_log: "log/unite/log",// 打印日志
}

module.exports = {
  /**
   * key 上面$Api的健名
   * param： 接口对接需要的参数
   * method: 请求方式，不写默认的post
   * callblack: 自定义失败回调，没有就按照常规
   * header: 请求头的改变
   * header 例子 
   * header = {
        "Content-Type": 'application/json',
        'Authorization': wx.getStorageSync('token')
      }
   */
  lhxRequest(key, param, method, callblack, header) {
    let url = $Api[key];
    let httpData = {
      url: url,
      data: param,
      method: method,
      header: header
    }
    return http(httpData, callblack)
  }
}